package company.meituan_F;

import java.util.Scanner;

//3 1 2
//        1 2
//        3 4
//        1 3
public class M4 {

    static int max;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] aMoney = new int[n];
        int[] bMoney = new int[n];
        for (int i = 0; i < n; i++) {
            aMoney[i] = sc.nextInt();
            bMoney[i] = sc.nextInt();
        }
        helper(n, a, b, 0, aMoney, bMoney, 0);
        System.out.println(max);
    }

    private static void helper(int n, int a, int b, int index, int[] aMoney, int[] bMoney, int money) {
        if (index == n)
            return;
        if (a == 0 && b == 0)
            max = Math.max(money, max);
        else {
            if (a > 0)
                helper(n, a - 1, b, index + 1, aMoney, bMoney, money + aMoney[index]);
            if (b > 0)
                helper(n, a, b - 1, index + 1, aMoney, bMoney, money + bMoney[index]);
            helper(n, a, b, index + 1, aMoney, bMoney, money);
        }
    }
}
